package com.base.myproject.client.busi;



import java.util.Date;

import com.base.myproject.client.tools.Debug;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
 
public class Main implements EntryPoint {


	@SuppressWarnings("unchecked")
	@Override
	public void onModuleLoad() {
	
		 DOM.setInnerHTML(RootPanel.get("zgwtest").getElement(), "");
		Debug.setIsdebug(true);
			Debug.setLevel(4);
			if(Debug.isIsdebug())
			{
				//RootPanel.get("zgwtest").add(new HTML("调试状态。。。。"));
				//Env.setEnvbcode("9999");
			}
	
			
			DateTimeFormat activeFormat2 = DateTimeFormat
			.getFormat("yyyy-M-d HH:mm:ss");
			Date dh = new Date();
			Debug.printf("登录："+activeFormat2.format(dh));
			 Debug.printf(GWT.getModuleName());

			 Debug.printf(GWT.getModuleBaseURL());
			 Debug.printf(GWT.getHostPageBaseURL());
			 Debug.printf(GWT.getPermutationStrongName());
			 Debug.printf(GWT.getVersion());
			 
		/*RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
				"gwtbase/BaseServlet?Action=validation");
		builder.setHeader("Content-Type",
				"application/x-www-form-urlencoded;charset=utf-8");

		builder.setCallback(new RequestCallback() {

			@Override
			public void onError(Request request, Throwable exception) {
				// TODO Auto-generated method stub
				System.out.println("error.....");
			}

			@Override
			public void onResponseReceived(Request request, Response response) {
				boolean success = Boolean.parseBoolean(response.getText());
				if (success) {
					URLFactory.Factory();
				} else {
					MessageBox.alert("提示", "贵公司对于该软件的的试用期已经到期（也可以是因为你修改了系统时间造成的访问失败，请改回原来的系统时间）", null);
				}
			}
		});
		try {
			builder.send();
		} catch (RequestException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		URLFactory.Factory();
	}
}
